1. Field
This disclosure relates generally to databases and, more specifically, to database replication.
2. Background Art
A replication agent allows users to maintain data in separate databases. For example, a replication agent replicates data from a source database to a target database. After replication, the target database contains accurate and current copies of data found in the source database. This ensures that the data in the source and target databases is synchronized, and allows a user to retrieve data from either a source or a target database, as well as rely on the target database in case of the source database failure.
Conventionally, a source database includes transaction logs to which it writes data definition language (DDL) commands, data manipulation language (DML) commands, data control language (DCL) commands, and/or transaction control language (TCL) commands. The DDL commands define tables, schemas, indexes, etc., in the source database. Example data definition statements include statements for making changes to data elements. Example changes to data elements include adding or deleting a table, truncating a table, adding a column to a table, removing a column from a table, and adding an index to a table, to name a few examples. To replicate those DDL commands, a conventional replication agent reads the transaction logs in the source database, identifies the DDL commands and transmits those DDL commands to target databases.
Some source databases do not write log records for changes to data elements such as tables, schemas, indexes, etc. As a result, DDL and other commands are not stored in transaction logs of the source database. However, in a heterogeneous system environment, target databases may require DDL commands to change their tables, schemas, indexes, etc., so that they are synchronized with the non-schema based databases. Whether a database does or does not require DDL commands to change data elements is of little difference to the user, provided the user's view of the data is consistent. The user however, relies on data synchronization between the source and target databases in the heterogeneous database system. As a result, there is a need for an improved replication technique to synchronize databases that do not write log records for changes to data elements (such as DDL and other commands), with the databases that require log records to maintain information associated with tables, schemas and indexes.
Additionally, some source databases do not allow direct access to their transaction logs. This occurs when a source database and a target database are developed by different parties who want to restrict access to data. Instead, an application programming interface (API) may be provided to retrieve data from the transaction logs. Therefore, there is also a need for a replication technique to synchronize a source and target databases using data records retrieved from transaction logs of the source database using an API.